package com.peng.leetcode.tree;

/**
 * InvertTree
 * 226. 翻转二叉树
 * https://leetcode.cn/problems/invert-binary-tree/
 * <p>
 * Created on 2022/11/30
 *
 * @author lupeng
 */
public class InvertTree {
    public TreeNode invertTree(TreeNode root) {
        if (root == null) {
            return null;
        }
        TreeNode temp = root.left;
        root.left = root.right;
        root.right = temp;
        invertTree(root.left);
        invertTree(root.right);
        return root;
    }
}
